import vue from "vue";
import vuex from "vuex";

//state, getters, mutations, actions
import state from "./state/index";
import getters from "./getters.js";
import mutations from "./mutations/index";
import actions from "./actions/index";

import createLogger from "vuex/dist/logger"; // 修改日志


vue.use(vuex);

const isDev = process.env.NODE_ENV !== "production"; // 开发环境中为true，否则为false
export default new vuex.Store({
  state,
  getters,
  mutations,
  actions,
  plugins: isDev ? [createLogger()] : [], // 开发环境下显示vuex的状态修改
});
